﻿using System;
using UnityEngine;

namespace UniRx.Triggers
{
	// Token: 0x0200042B RID: 1067
	[DisallowMultipleComponent]
	public class ObservableCollisionTrigger : ObservableTriggerBase
	{
		// Token: 0x06001644 RID: 5700 RVA: 0x0006143B File Offset: 0x0005F83B
		private void OnCollisionEnter(Collision collision)
		{
			if (this.onCollisionEnter != null)
			{
				this.onCollisionEnter.OnNext(collision);
			}
		}

		// Token: 0x06001645 RID: 5701 RVA: 0x00061454 File Offset: 0x0005F854
		public IObservable<Collision> OnCollisionEnterAsObservable()
		{
			Subject<Collision> result;
			if ((result = this.onCollisionEnter) == null)
			{
				result = (this.onCollisionEnter = new Subject<Collision>());
			}
			return result;
		}

		// Token: 0x06001646 RID: 5702 RVA: 0x0006147C File Offset: 0x0005F87C
		private void OnCollisionExit(Collision collisionInfo)
		{
			if (this.onCollisionExit != null)
			{
				this.onCollisionExit.OnNext(collisionInfo);
			}
		}

		// Token: 0x06001647 RID: 5703 RVA: 0x00061498 File Offset: 0x0005F898
		public IObservable<Collision> OnCollisionExitAsObservable()
		{
			Subject<Collision> result;
			if ((result = this.onCollisionExit) == null)
			{
				result = (this.onCollisionExit = new Subject<Collision>());
			}
			return result;
		}

		// Token: 0x06001648 RID: 5704 RVA: 0x000614C0 File Offset: 0x0005F8C0
		private void OnCollisionStay(Collision collisionInfo)
		{
			if (this.onCollisionStay != null)
			{
				this.onCollisionStay.OnNext(collisionInfo);
			}
		}

		// Token: 0x06001649 RID: 5705 RVA: 0x000614DC File Offset: 0x0005F8DC
		public IObservable<Collision> OnCollisionStayAsObservable()
		{
			Subject<Collision> result;
			if ((result = this.onCollisionStay) == null)
			{
				result = (this.onCollisionStay = new Subject<Collision>());
			}
			return result;
		}

		// Token: 0x0600164A RID: 5706 RVA: 0x00061504 File Offset: 0x0005F904
		protected override void RaiseOnCompletedOnDestroy()
		{
			if (this.onCollisionEnter != null)
			{
				this.onCollisionEnter.OnCompleted();
			}
			if (this.onCollisionExit != null)
			{
				this.onCollisionExit.OnCompleted();
			}
			if (this.onCollisionStay != null)
			{
				this.onCollisionStay.OnCompleted();
			}
		}

		// Token: 0x04000C8E RID: 3214
		private Subject<Collision> onCollisionEnter;

		// Token: 0x04000C8F RID: 3215
		private Subject<Collision> onCollisionExit;

		// Token: 0x04000C90 RID: 3216
		private Subject<Collision> onCollisionStay;
	}
}
